package com.example.runningdemo.designModel.factory.abstracts;

/**
 * @program: Running-Demo
 * @description: 抽象工厂类
 * @author: kangwei
 * @create: 2024-08-09 08:49
 **/
public interface AbstractWaterFactory {

    Water createWater();

    WheatFlour createWheatFlour();

    // 由具体工厂实现抽象工厂
    class WaterFactoryImpl implements AbstractWaterFactory {

        @Override
        public Water createWater() {
            return new Water.DrinkingWater();
        }

        @Override
        public WheatFlour createWheatFlour() {
            return new WheatFlour.SoyFlour();
        }
    }

    public static void main(String[] args) {
        System.out.println(new WaterFactoryImpl().createWater());
    }
}
